<?php


namespace app\cms\community\thirdPartyApi\aliyun\OSS;

use OSS\OssClient;

/**
 * Class OSSBucket
 * @mixin OssClient
 * @package app\cms\community\thirdPartyApi\aliyun\OSS
 */
class OSSBucket extends OSSBase
{

    /**
     * 创建桶
     * @param string $bucket
     * @param array $options
     * @param string $acl
     * @return $this
     */
    public function createBucket(string $bucket = '', array $options = [], string $acl = ''): static
    {
        $options = $options ?? [
                $this->ossClient::OSS_STORAGE => $this->ossClient::OSS_STORAGE_STANDARD
            ];
        $acl = $acl ?: $this->ossClient::OSS_ACL_TYPE_PRIVATE;
        $this->ossClient -> createBucket($bucket, $acl, $options);
        return $this;
    }

    public function __call(string $name, array $arguments)
    {
        // TODO: Implement __call() method.
        if (method_exists($this->ossClient, $name))
            return call_user_func([$this->ossClient, $name], ...$arguments);
        return null;
    }

}